import Vue from "vue";
import Vuex from "vuex";
import VuexPersistence from "vuex-persist";
import actions from "./actions";
import mutations from "./mutations";

Vue.use(Vuex);

const state = {
  token: "",
  collapse: false,
  username: "",
};

const vuexLocal = new VuexPersistence({
  key: "custom-key",
  storage: window.localStorage
});

export default new Vuex.Store({
  state,
  actions,
  mutations,
  plugins: [vuexLocal.plugin]
});
